package com.gs.cd.service.old.controller.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.gs.cd.model.resource.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.constraints.Email;
import javax.validation.constraints.Size;
import java.beans.Transient;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author hippo
 * @since 2020-02-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class User extends BaseEntity {

    private static final long serialVersionUID = 1L;

    private Long id;

    /**
     * 姓名
     */
    @Size(min = 0, max = 50, message = "姓名长度不能超过50个字符")
    private String name;

    @Size(min = 0, max = 20, message = "登录名长度不能超过20个字符")
    @JsonProperty("login_name")
    private String loginName;

    @Size(min = 0, max = 20, message = "密码长度不能超过20个字符")
    @JsonProperty("password")
    private String loginPassword;

    /**
     * 用户类型：1系统用户，2sso等
     */
    private Integer userType;

    private String loginLastIp;

    private Date loginLastTime;


    @Email(message = "新填写正确邮箱地址")
    private String email;

    private String ssoUserId;

    private Boolean canDelete;

    @JsonProperty("role_ids")
    private List<Long> roleIds;

    /**
     * 是否后台管理员 admin-可访问和使用后台，非admin-不可以
     */
    private Boolean isAdmin;

}
